﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SwarmMappingAlpha
{
    /// <summary>
    /// Class used to provide creation methods for any collection used in this project
    /// </summary>
    static class CollectionFactory
    {
        public static Dictionary<String, Node> buildNodeDictionary(int worldWidth, int worldHeight, int nodeSize)
        {
            Dictionary<String, Node> resultCollection = new Dictionary<string,Node>();
            int numberOfNodes = 0;
            int newHeight = worldHeight / nodeSize;
            int newWidth = worldWidth / nodeSize;

            for (int i = 1; i <= newWidth   ; i++)
            {
                for (int j = 1; j <= newHeight; j++)
                {
                    Node nextNode = new Node(i * nodeSize, j * nodeSize, numberOfNodes, worldHeight, nodeSize / 2);
                    resultCollection.Add(nextNode.makeKey(), nextNode);
                    numberOfNodes++;
                }
            }

            return resultCollection;
        }
    }
}
